<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\Archive
 *
 * @property string $record_no
 * @property string $message 案卷内容
 * @property [] $photos 图片
 * @property string $video 视频
 * @property string $video_thumb 视频封面图
 * @property string $audio 语言
 * @property float $latitude 纬度
 * @property float $longitude 经度
 * @property string $address 地址
 * @property int|null $user_id 上传用户
 * @property int $record_num 巡查次数
 * @property string $record_username 巡查人
 * @property string $record_people 记录人
 * @property \Carbon\Carbon|null $record_date 记录时间
 * @property \Carbon\Carbon|null $created_at
 * @property \Carbon\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive whereAddress($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive whereAudio($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive whereLatitude($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive whereLongitude($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive whereMessage($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive wherePhotos($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive whereRecordDate($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive whereRecordNo($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive whereRecordNum($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive whereRecordPeople($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive whereRecordUsername($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive whereUserId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive whereVideo($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive whereVideoThumb($value)
 * @mixin \Eloquent
 * @property string $phone 上报人电话
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive wherePhone($value)
 * @property int $status 案卷状态
 * @property-read \App\Models\User|null $user
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Archive whereStatus($value)
 */
class Archive extends Model
{
    //

    protected $dates = [
        "created_at",
        "updated_at",
        "record_date"
    ];

    protected $casts = [
        'photos' => 'array',
        'process' => 'array'
    ];

    protected $guarded = [];

    public function user()
    {
        return $this->belongsTo("App\Models\User", "user_id", "id");
    }

//    public function setPhotosAttribute($value)
//    {
//        $this->attributes['photos'] = implode(",", $value);
//    }
//
//    public function getPhotosAttribute($value)
//    {
//        return explode(",", $value);
//    }
}
